/**
 * JungoPushModule
 * PushModuleMain.java
 * 
 * Copyright 2013 Teachizen
 * Written by cloudstick
 *	2013. 8. 12. first written.
 *
 * note:
 */
package com.jungo.module.main;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import lombok.extern.slf4j.Slf4j;

/**
 * @author cloudstick
 *
 */
@Slf4j
public class PushModuleMain {

	public static void main(String[] args) throws InterruptedException 
	{		
		log.info("Push module started.");
		
		Runtime.getRuntime().addShutdownHook
		( 
			new Thread() 
			{
				public void run()
				{
					log.info("Push module stop.");
					synchronized (this)
					{
						this.notifyAll();
					}
				}
			}
		);
		
		final String [] configLocation = new String[] {"config/spring/context-common.xml",
												"config/spring/context-datasource.xml"};
		
		@SuppressWarnings("unused")
		final ApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
		final PushModuleMain allocatorMain = new PushModuleMain();
		allocatorMain.await();
	}

	public void await() throws InterruptedException
	{
		boolean isExit = false;
		while(!isExit)
		{
			synchronized (this)
			{
				this.wait();
				isExit = true;
			}
		}
	}
	
}
